/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package html_parse;
import java.io.IOException;
import java.sql.*;
import java.util.ArrayList;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.Date;
/**
 *
 * @author mrquangson123
 */
public class FuncHoThuoc {
    String UserName;
    String Password;
    String url;
    public  FuncHoThuoc(String UserName,String Password,String url )
            
    {
        this.Password=Password;
        this.UserName=UserName;
        
        
            this.url="jdbc:mysql://localhost:3306/TuDienCayThuoc";
       
        
    }
    public ArrayList<HoThuoc> getHoThuoc(String link)
    {
        ArrayList<HoThuoc> lsHoThuoc=new ArrayList<HoThuoc>();
        return  lsHoThuoc;
    }
    public void func_Insert_HoThuoc(String Description,String Note,Date DateCreated,Date DateUpdate,int IDLoaiThuoc,String NameVN,String NameEN)
    {
        
         Connection conn=null;
        try
        {
            /*
             INSERT INTO HoThuoc(ID,IDLoaiThuoc,NameVN,NameEN,Description,Note,DateCreated,DateUpdate) VALUES
                (<{ID: }>,<{IDLoaiThuoc: }>,<{NameVN: }>,<{NameEN: }>,<{Description: }>,<{Note: }>,<{DateCreated: }>,<{DateUpdate: }>);
             */
            conn=DriverManager.getConnection(url, UserName, Password);
            PreparedStatement preS=conn.prepareStatement("INSERT INTO HoThuoc(IDLoaiThuoc,NameVN,NameEN,Description,Note,DateCreated,DateUpdate) VALUES"+

                                                        " (?,?,?,?,?,?,?);");
            preS.setString(1,String.valueOf(IDLoaiThuoc));
            preS.setString(2,String.valueOf(NameVN));
            preS.setString(3,String.valueOf(NameEN));
            preS.setString(4,String.valueOf(Description));
            preS.setString(5,String.valueOf(Note));
            preS.setString(6,String.valueOf(DateCreated));
            preS.setString(7,String.valueOf(DateUpdate));
            
           
            preS.executeUpdate();
            conn.close();
        }
        catch(Exception ex)
        {
            System.out.println(ex.toString());
        }
    }
    
}
